import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import ResponsiveImage from '@/components/ResponsiveImage'
import css from './postPictures.module.scss'
export default class SpacePostPictures extends PureComponent {
    static propTypes = {
        pictures: PropTypes.array,
        size: PropTypes.string
    }

    static defaultProps = {
        pictures: [],
        size: '@268w_356h_1c'
    }

    get picNums() {
        return this.props.pictures.length
    }

    render() {
        const { pictures, size } = this.props
        return (
            <ul className={css[this.picNums > 1 ? 'wraps' : 'wrap']}>
                {
                    pictures.map((item, index) => {
                        return (
                            <li className="cell" key={index}>
                                <ResponsiveImage className="cell-image" src={item.img_src} size={size} />
                            </li>
                        )
                    })
                }
            </ul>
        )
    }
}
